<?php
/*
 * @FileForDetails: 校区验证器
 * @Date: 2022-11-30 15:35:30
 */
namespace app\crm\validate\product;

use think\Validate;

class Campus extends Validate
{
    /**
     * 验证规则
     */
    protected $rule = [
        'name' => "require|length:2,30",
        'campus_no' => "require|length:5",
        'phone' => "require|mobile",
        'address' => "require|max:200",
        'sort' => "require|integer|between:1,99",
    ];

    /**
     * 提示消息
     */
    protected $message = [
        'name.require'      => "校区名称必须填写",
        'name.length'       => "校区名称限制在2~30个字符之间",
        'campus_no.require' => "校区编码必须填写",
        'campus_no.length'  => "校区编码限定固定5个英文字符",
        'phone.require'     => "校区电话必须填写",
        'phone.mobile'      => "手机格式不正确",
        'address.require'   => "校区地址必须填写",
        'sort.between'      => "排序值范围1~99"
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'add' => [],
        'edit' => [],
    ];
}